<script>
import districtTable from "@/view/components/districtTable.vue";

export default {
  components: {
    districtTable: districtTable
  },
  data() {
    return {
      tableConfig: {
        control: 't-district',
        mainKey: 'districtCode', //数据主键，用于删除该条数据
      },
      tableColumns: [{
        name: 'districtName',
        label: '区划名称',
        id: 'districtName',
        search: true,
        required: false,
        searchType: 'input',
      }, {
        name: 'districtCode',
        label: '区划编码',
        id: 'districtCode',
        search: false,
        required: false,
        searchType: 'input',
      }, {
        name: 'parentDistrictCode',
        label: '所属上级区划',
        id: 'parentDistrictCode',
        search: false,
        hide: true,
        required: '/t-district/findTree',
        notMust:true,
        requiredProp: {
          label: 'name',
          value: 'districtCode'
        },
        searchType: 'tree',

      }, {
        name: 'stationName',
        label: '站点名称',
        id: 'stationName',
        search: false,
        searchType: 'state',
        addHide: true,
      }, {
        name: 'createDate',
        label: '创建时间',
        id: 'createDate',
        search: false,
        searchType: 'state',
        addHide: true,
      }, {
        name: 'createUserName',
        label: '创建人',
        id: 'createUserName',
        search: false,
        searchType: 'state',
        addHide: true,
      }, {
        name: 'state',
        label: '状态',
        id: 'state',
        search: false,
        required: '/common/getItem/state',
        searchType: 'state',
        getValue: (state) => {
          return state === '01' ? '有效' : '无效'
        }
      }],
    }
  },
}
</script>

<template>
  <div class="page-car">
    <district-table :table-config="tableConfig" :table-columns="tableColumns"></district-table>
  </div>
</template>

<style scoped>
::v-deep .el-cascader {
  width: 100% !important;
}
</style>
